﻿namespace mVids
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms;

    public class choiceControl : UserControl
    {
        private List<mVids.artistInfo> artists = new List<mVids.artistInfo>();
        private IContainer components = null;
        private TextBox customBox;
        public bool done = false;
        private TextBox filenameBox;
        private Label label1;
        private Label label2;
        private Label label3;
        public Button okbtn;
        public TextBox parsedArtistBox;
        private ListBox resultsList;
        public Button retryBtn;
        public Button skipbtn;
        private mVids.musicVideo video;

        public choiceControl(List<mVids.artistInfo> choices, mVids.musicVideo vid, string artist)
        {
            this.InitializeComponent();
            this.filenameBox.Text = vid.Path;
            this.parsedArtistBox.Text = artist.Trim();
            foreach (mVids.artistInfo info in choices)
            {
                this.resultsList.Items.Add(info.name);
            }
            this.artists = choices;
            this.video = vid;
        }

        private void customBox_TextChanged(object sender, EventArgs e)
        {
            if (this.customBox.Text != "")
            {
                this.retryBtn.Enabled = true;
            }
            else
            {
                this.retryBtn.Enabled = false;
            }
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        public mVids.artistInfo getartistInfo()
        {
            return this.artists[this.resultsList.SelectedIndex];
        }

        public string getCustomStr()
        {
            return this.customBox.Text;
        }

        public mVids.musicVideo getVid()
        {
            return this.video;
        }

        public mVids.musicVideo getVidWithInfo()
        {
            if (this.resultsList.SelectedItem == null)
            {
                return null;
            }
            this.video.aI = this.artists[this.resultsList.SelectedIndex];
            return this.video;
        }

        private void InitializeComponent()
        {
            this.label1 = new Label();
            this.filenameBox = new TextBox();
            this.resultsList = new ListBox();
            this.parsedArtistBox = new TextBox();
            this.label2 = new Label();
            this.customBox = new TextBox();
            this.label3 = new Label();
            this.okbtn = new Button();
            this.skipbtn = new Button();
            this.retryBtn = new Button();
            base.SuspendLayout();
            this.label1.AutoSize = true;
            this.label1.Location = new Point(0x11, 15);
            this.label1.Name = "label1";
            this.label1.Size = new Size(0x34, 13);
            this.label1.TabIndex = 0;
            this.label1.Text = "Filename:";
            this.filenameBox.Location = new Point(0x4b, 12);
            this.filenameBox.Name = "filenameBox";
            this.filenameBox.ReadOnly = true;
            this.filenameBox.Size = new Size(0x125, 20);
            this.filenameBox.TabIndex = 1;
            this.resultsList.FormattingEnabled = true;
            this.resultsList.Location = new Point(20, 0x44);
            this.resultsList.Name = "resultsList";
            this.resultsList.Size = new Size(0x15c, 0x52);
            this.resultsList.TabIndex = 2;
            this.parsedArtistBox.Location = new Point(0x5c, 0x26);
            this.parsedArtistBox.Name = "parsedArtistBox";
            this.parsedArtistBox.ReadOnly = true;
            this.parsedArtistBox.Size = new Size(0x114, 20);
            this.parsedArtistBox.TabIndex = 4;
            this.label2.AutoSize = true;
            this.label2.Location = new Point(0x11, 0x29);
            this.label2.Name = "label2";
            this.label2.Size = new Size(0x45, 13);
            this.label2.TabIndex = 3;
            this.label2.Text = "Parsed Artist:";
            this.customBox.Location = new Point(0x41, 0xbf);
            this.customBox.Name = "customBox";
            this.customBox.Size = new Size(0xde, 20);
            this.customBox.TabIndex = 5;
            this.customBox.TextChanged += new EventHandler(this.customBox_TextChanged);
            this.label3.AutoSize = true;
            this.label3.Location = new Point(110, 0x9e);
            this.label3.Name = "label3";
            this.label3.Size = new Size(0x99, 0x1a);
            this.label3.TabIndex = 6;
            this.label3.Text = "Select the correct Artist above\r\nor enter a different name below";
            this.okbtn.Location = new Point(0x125, 0x9c);
            this.okbtn.Name = "okbtn";
            this.okbtn.Size = new Size(0x4b, 0x17);
            this.okbtn.TabIndex = 7;
            this.okbtn.Text = "OK";
            this.okbtn.UseVisualStyleBackColor = true;
            this.okbtn.Click += new EventHandler(this.okbtn_Click);
            this.skipbtn.Location = new Point(20, 0x9c);
            this.skipbtn.Name = "skipbtn";
            this.skipbtn.Size = new Size(0x4b, 0x17);
            this.skipbtn.TabIndex = 8;
            this.skipbtn.Text = "Skip";
            this.skipbtn.UseVisualStyleBackColor = true;
            this.retryBtn.Enabled = false;
            this.retryBtn.Location = new Point(0x125, 0xbc);
            this.retryBtn.Name = "retryBtn";
            this.retryBtn.Size = new Size(0x4b, 0x17);
            this.retryBtn.TabIndex = 9;
            this.retryBtn.Text = "Retry";
            this.retryBtn.UseVisualStyleBackColor = true;
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.BorderStyle = BorderStyle.FixedSingle;
            base.Controls.Add(this.retryBtn);
            base.Controls.Add(this.skipbtn);
            base.Controls.Add(this.okbtn);
            base.Controls.Add(this.label3);
            base.Controls.Add(this.customBox);
            base.Controls.Add(this.parsedArtistBox);
            base.Controls.Add(this.label2);
            base.Controls.Add(this.resultsList);
            base.Controls.Add(this.filenameBox);
            base.Controls.Add(this.label1);
            base.Name = "choiceControl";
            base.Size = new Size(0x184, 0xe2);
            base.ResumeLayout(false);
            base.PerformLayout();
        }

        private void okbtn_Click(object sender, EventArgs e)
        {
            this.done = true;
        }

        public void setup(List<string> choices, mVids.musicVideo vid, string artist)
        {
        }
    }
}

